<script setup>
import StatCards from '../components/StatCards.vue'
import SortBar from '../components/SortBar.vue'
import AchievementList from '../components/AchievementList.vue'
import PaginationBar from '../components/PaginationBar.vue'

import { ref, computed } from 'vue'

const achievementListRef = ref(null)
const pageSize = ref(10)

const handleFilter = (type) => {
  achievementListRef.value?.handleFilter(type)
}

const totalAchievements = computed(() => {
  return achievementListRef.value?.filteredAchievements?.length || 0
})
</script>

<template>
  <vdsvls :total="totalAchievements"> </vdsvls>
  <div>
    <StatCards />
    <SortBar />
    <AchievementList ref="achievementListRef" />
    <PaginationBar :total="totalAchievements" :page-size="pageSize" />
  </div>
</template>

<style scoped>
.main-container {
  height: 100vh;
  background: #f5f6fa;
  display: flex;
  flex-direction: row;
}
.right-container {
  height: 100vh;
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.main-content {
  background: #f5f6fa;
  min-height: calc(100vh - 64px);
  padding: 32px 24px 0 24px;
  overflow-x: hidden;
}

@media screen and (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }
  .main-content {
    padding: 16px;
  }
}
</style>
